/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entitys;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author RIVERA
 */
@Entity
@Table(name = "factura", catalog = "drugstore", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Factura.findAll", query = "SELECT f FROM Factura f"),
    @NamedQuery(name = "Factura.findByIdFactura", query = "SELECT f FROM Factura f WHERE f.idFactura = :idFactura"),
    @NamedQuery(name = "Factura.findByIdPersona", query = "SELECT f FROM Factura f WHERE f.idPersona = :idPersona"),
    @NamedQuery(name = "Factura.findByTotal", query = "SELECT f FROM Factura f WHERE f.total = :total")})
public class Factura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_FACTURA", nullable = false)
    private Integer idFactura;
    @Basic(optional = false)
    @Column(name = "ID_PERSONA", nullable = false)
    private long idPersona;
    @Basic(optional = false)
    @Column(name = "TOTAL", nullable = false)
    private float total;
    @Column(name = "Fecha_Factura", nullable = false)
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date fecha;
    //se debe ejecutar esta implementacion

    public Factura() {
    }

//    public Factura(Integer idFactura) {
//        this.idFactura = idFactura;
//    }

    public Factura(long idPersona, float total, Date fecha) {
        this.idPersona = idPersona;
        this.total = total;
        this.fecha=fecha;
    }

    public Integer getIdFactura() {
        return idFactura;
    }

    public void setIdFactura(Integer idFactura) {
        this.idFactura = idFactura;
    }

    public long getIdPersona() {
        return idPersona;
    }

    public void setIdPersona(long idPersona) {
        this.idPersona = idPersona;
    }

    public float getTotal() {
        return total;
    }

    public void setTotal(float total) {
        this.total = total;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFactura != null ? idFactura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Factura)) {
            return false;
        }
        Factura other = (Factura) object;
        if ((this.idFactura == null && other.idFactura != null) || (this.idFactura != null && !this.idFactura.equals(other.idFactura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entitys.Factura[ idFactura=" + idFactura + " ]";
    }
    
}
